#!/usr/bin/python
#-*- coding:utf-8-*-
import sys
ROOT_PATH = sys.path[0]
sys.path.append(ROOT_PATH)
import os

class Run:
    def __init__(self):
        self.run_app('main','8051')
        self.run_app('ping','8099')
        
    def run_app(self,app,port):
        pid = os.fork()
        if not pid:
            appfile = '%s/app/%s/run.pyw' % (ROOT_PATH,app)
            print appfile
            os.execvp('python',('python',appfile,port,'fastcgi'))
